package cn.yunhe.controller;

import java.util.HashMap;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.yunhe.model.ResultModel;
import cn.yunhe.service.IDemoService;
import cn.yunhe.service.impl.DemoServiceImpl;

@RestController
@RequestMapping("/restdemo")
public class RestDemoController {
	
	Logger logger = LogManager.getLogger(RestDemoController.class);
	
	@Autowired
	private IDemoService DemoServiceImpl;
	
	@RequestMapping("/test1")
    public ResultModel<?> getUser(){		
		logger.debug(DemoServiceImpl.demoTest());
		ResultModel<Map<String, Object>> result = new ResultModel<Map<String, Object>>();
		result.setCode("0");
		result.setMsg("正常");
		Map<String, Object> map= new HashMap<String, Object>();
		map.put("zs", 20);
		map.put("ls", 30);
		int a = 0;
		if (a==0) {
			throw new NullPointerException();
		}
		result.setData(map);
		return result;
	}
}
